home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
util
/
boot
/
ShadowStart13.lha
/
ShadowStart13
/
3.1
/
ShadowStart.c
< prev
Wrap
C/C++ Source or Header
|
1995-08-15
|
6KB
|
153 lines
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by Lars Eilebrecht (Shadowfox)
**
** File : Work:Program/SC/PRG/ShadowStart/ShadowStart.c
** Created on : Mittwoch, 16.11.94 17:23:09
** Created by : Lars Eilebrecht
** Current revision : V1.3
**
**
** Purpose
** -------
** Disable "WBStartup" and/or "User-Startup" during startup. (V40)
**
** Revision V1.3
** --------------
** created on Montag, 14.08.95 22:41:18 by Lars Eilebrecht. LogMessage :
** - added validation test for SYS: partition
** minor code changes
**
** Revision V1.2
** --------------
** created on Freitag, 09.12.94 01:06:44 by Lars Eilebrecht. LogMessage :
** - minor code changes
**
** Revision V1.1
** --------------
** created on Montag, 28.11.94 18:58:55 by Lars Eilebrecht. LogMessage :
** -*- changed on Samstag, 03.12.94 22:12:20 by Lars Eilebrecht. LogMessage :
** - recompiled ShadowStart without startup-code
** (results in a shorter executable)
** -*- created on Montag, 28.11.94 18:58:55 by Lars Eilebrecht. LogMessage :
** - added NewShell-button
** renamed other buttons, so that it fit on a lores-screen
** removed stdio.h include (shorter executable)
** cleaned up code a little
**
** Revision V1.0
** --------------
** created on Mittwoch, 16.11.94 17:23:09 by Lars Eilebrecht. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
#define REVISION "1.3"
#define REVDATE "14.08.95"
#define REVTIME "22:41:18"
#define AUTHOR "Lars Eilebrecht"
#define VERNUM 1
#define REVNUM 3
#define TITLE "ShadowStart "REVISION" ("REVDATE") (V40) © by "AUTHOR
#include <exec/types.h>
#include <intuition/intuition.h>
#include <libraries/lowlevel.h>
#include <libraries/dos.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/dos_pragmas.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/lowlevel_pragmas.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/intuition_protos.h>
#include <clib/lowlevel_protos.h>
static const char ver[]="$VER: "TITLE"\0";
int ShadowStart(void)
{
LONG rc=RETURN_FAIL;
struct Library *DOSBase;
if(DOSBase=OpenLibrary("dos.library",37))
{
struct Library *LowLevelBase;
if(LowLevelBase=OpenLibrary("lowlevel.library",40))
{
struct Library *IntuitionBase;
if(IntuitionBase=OpenLibrary("intuition.library",37))
{
BPTR syslock=Lock("SYS:",ACCESS_READ); // get lock on SYS: partition
rc=RETURN_OK; // so far it's ok...
if(syslock) // Got a lock? Exit, if not...
{
struct KeyQuery spacebar = // declare KeyQuery-struct
{
(UWORD)64, // rawkeycode for spacebar
FALSE, // not pressed yet...
};
struct InfoData id;
BOOL success=success=Info(syslock,&id); // get info on SYS:
while(success&&(id.id_DiskState==ID_VALIDATING))
{ // delay program excution until SYS: is validated
Delay(150); // wait 3 seconds...
success=Info(syslock,&id); // and check again
}
if(!success)
rc=RETURN_FAIL;
if(Rename("SYS:_WBStartup","SYS:WBStartup")) // rename to original names
Rename("SYS:_WBStartup.info","SYS:WBStartup.info");
Rename("SYS:S/_User-Startup","SYS:S/User-Startup");
QueryKeys(&spacebar,(UBYTE)1); // dirty spacebar check ;-)
if(spacebar.kq_Pressed) // Was it pressed? Silent exit, if not...
{
LONG result;
struct EasyStruct shadowES = // declare EasyRequest-struct
{
sizeof(struct EasyStruct),
0, // no flags
"ShadowStart "REVISION" ("REVDATE") © by Lars `SFX' Eilebrecht",
"\nSelect startup-items you want to disable\n\nor select `NewShell' to open a shell-window\n",
"WB + User|WB|User|NewShell|Cancel",
};
result=EasyRequest(NULL,&shadowES,NULL);
switch (result)
{ // note: success of rename-operation isn't checked...
case 1:
Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
case 2:
Rename("SYS:WBStartup","SYS:_WBStartup");
Rename("SYS:WBStartup.info","SYS:_WBStartup.info");
break;
case 3:
Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
break;
case 4:
if(!Execute("NewShell",0,0)) // open a shell-window...
rc=RETURN_FAIL;
Wait(SIGBREAKF_CTRL_C); // 'hold' startup-sequence...
}
}
UnLock(syslock);
}
CloseLibrary(IntuitionBase);
}
else
PrintFault(ERROR_INVALID_RESIDENT_LIBRARY,"intuition.library");
CloseLibrary(LowLevelBase);
}
else
PrintFault(ERROR_INVALID_RESIDENT_LIBRARY,"lowlevel.library");
CloseLibrary(DOSBase);
}
return(rc);
}